import org.jcsp.lang.*;


public class PhilCall {

  public static void main (String[] args)  {
	  int nPhilosophers = 5;
      if (args.length!=1) {
          System.err.println("Argument requested: Number of Philosophers dining");
          return;
      }
      else
      {
	   nPhilosophers = Integer.parseInt(args[0]);
   }

    PhilChannel philChannel = new PhilChannel ();
    ForkChannel forkChannel = new ForkChannel ();
    One2OneChannelInt securityChannel = Channel.one2oneInt ();

    new Parallel (
      new CSProcess[] {
        new Philosophers (
          nPhilosophers, 
          philChannel, forkChannel,
          securityChannel.out ()
        ),
        new DisplayText (
          nPhilosophers,
          philChannel, forkChannel,
          securityChannel.in ()
        )
      }
    ).run ();
  }

}
